﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;

namespace LosConn.Web.Order
{
    public partial class OrderShopping : BasePage.AdminBasePage
    {
        public String html = String.Empty;
        public String input = String.Empty;
        public String guest = String.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                html = GetTypeSelect();
                guest = GetGuestSelect();
            }
        }

        /// <summary>
        /// 获取类型
        /// </summary>
        private string GetTypeSelect()
        {
            BLL.Los_Type bllType = new BLL.Los_Type();
            StringBuilder sb = new StringBuilder(500);
            StringBuilder sbInput = new StringBuilder(500);
            DataTable dt = bllType.GetList(" Type_Status=100 ").Tables[0];
            sb.Append("<select id=\"Type_ID\" class=\"input-medium\">");
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    sbInput.AppendFormat("<input type=\"hidden\" id=\"type{0}\" val1=\"{1}\" class=\"typeInput\">", dr["Type_ID"], dr["Type_Name"]);
                    //sbInput.AppendFormat("<input type=\"text\" id=\"typeNum{0}\" val1=\"{1}\" class=\"typeNumber\">", dr["Type_ID"], dr["Type_Name"]);
                    sb.AppendFormat("<option value=\"{0}\">{1}</option>", dr["Type_ID"], dr["Type_Name"]);
                }
            }
            sb.Append("</select>");
            input = sbInput.ToString();
            return sb.ToString();
        }

        private string GetGuestSelect()
        {
            BLL.Los_Guest bllGuest = new BLL.Los_Guest();
            StringBuilder sb = new StringBuilder(500);
            //StringBuilder sbInput = new StringBuilder(500);
            DataTable dt = bllGuest.GetGuestList(" Guest_Stauts in (500,700,800) ").Tables[0];
            //DataTable dt = bllGuest.GetGuestList(" ").Tables[0];
            //sb.Append("<select id=\"Guest_ID\" class=\"input-medium\">");
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //sbInput.AppendFormat("<input type=\"hidden\" id=\"guest{0}\" val1=\"{1}\" class=\"typeInput\">", dr["Type_ID"], dr["Type_Name"]);
                    //sbInput.AppendFormat("<input type=\"text\" id=\"typeNum{0}\" val1=\"{1}\" class=\"typeNumber\">", dr["Type_ID"], dr["Type_Name"]);
                    sb.AppendFormat("<option value=\"{0}\">{1}</option>", dr["Guest_ID"], dr["Guest_Name"]);
                }
            }
            //sb.Append("</select>");
            //input = sbInput.ToString();
            return sb.ToString();
        }
    }
}